---
title: File System Chat Message History
---

The `FileSystemChatMessageHistory` uses a JSON file to store chat message history. For longer-term persistence across chat sessions, you can swap out the default in-memory `chatHistory` that backs chat memory classes like `BufferMemory`.

## Setup

You'll first need to install the [`@langchain/community`](https://www.npmjs.com/package/@langchain/community) package:

```bash npm
npm install @langchain/community @langchain/core
```
import IntegrationInstallTooltip from '/snippets/javascript-integrations/integration-install-tooltip.mdx';

<IntegrationInstallTooltip/>

```bash npm
npm install @langchain/openai @langchain/community @langchain/core
```

## Usage

import File from "/snippets/javascript-integrations/examples/memory/file.mdx";

<File />
